package cn.lizheng.web;

import cn.lizheng.dao.AdmininfoDAO;
import cn.lizheng.dao.AdmininfoDAOImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/admindelete")
public class AdminDelete extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        String idStr=req.getParameter("adminid");
        //字符串转整数
        int id= Integer.parseInt(idStr);
        AdmininfoDAO dao=new AdmininfoDAOImpl();
        dao.delete(id);
        //页面跳转  跳转到某个页面
        req.getRequestDispatcher("adminList").forward(req,resp);
    }
}
